<html>
<br> <canvas id="canvasNewOffscreen" width="60" height="60"></canvas>

<script>
  if (window.testRunner) {
    testRunner.waitUntilDone();
  }
  // source content as canvas
  var htmlCanvas = document.createElement('canvas');
  htmlCanvas.width = 60;
  htmlCanvas.height = 60;
  var htmlCanvasCtx = htmlCanvas.getContext("2d");
  htmlCanvasCtx.fillStyle = "blue";
  htmlCanvasCtx.fillRect(0, 0, 15, 60);
  htmlCanvasCtx.fillStyle = "red";
  htmlCanvasCtx.fillRect(15, 0, 45, 30);
  htmlCanvasCtx.fillStyle = "green";
  htmlCanvasCtx.fillRect(15, 30, 45, 30);

  createImageBitmap(htmlCanvas).then(function(bmap){
    // Fill canvasNewOffscreen
    var outputCanvas = document.getElementById("canvasNewOffscreen");
    var outputCanvasRenderer = outputCanvas.getContext("bitmaprenderer");
    outputCanvasRenderer.transferFromImageBitmap(bmap);

    if (window.testRunner) {
      requestAnimationFrame(() => {
        testRunner.notifyDone();
      });
    }
  });

</script>
</html>